package com.pwt.controller.largescreen;

import com.pwt.common.ResultPage;
import com.pwt.model.*;
import com.pwt.repository.WERTEVARRepository;
import com.pwt.service.LargeScreenService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author dw
 * @date 2021/11/15 15:35
 * @Description
 */
@RestController
@Tag(name = "大屏展示接口",description = "大屏展示接口")
public class LargeScreenController {

    LargeScreenService screenService;


    public LargeScreenController(LargeScreenService screenService) {
        this.screenService = screenService;
    }

    @GetMapping("total")
    @Operation(description = "总览数据",summary = "总览数据")
    public TotalDataModel getTotalData(){
       return this.screenService.getTotalData();
    }

    @GetMapping("pie-diagram")
    @Operation(description = "当天产品cp,cpk分布情况",summary = "当天产品cp,cpk分布情况")
    public List<DataModel> getTodayCpCpk(){
        return this.screenService.getTodayCpCpk();
    }

    @GetMapping("event")
    @Operation(description = "产品事件措施原因列表",summary = "产品事件措施原因列表")
    @Parameters({
            @Parameter(name = "page",description = "当前页",required = true),
            @Parameter(name = "limit",description = "展示数",required = true)
    })
    public ResultPage<EventMeasuresModel> getEventMeasures(@RequestParam(required = true) Integer page,@RequestParam(required = true) Integer limit){
        return this.screenService.getEventMeasures(page,limit);
    }

    @GetMapping("productionStation")
    @Operation(description = "工位生产情况",summary = "工位生产情况")
    public List<ProductionStationModel> productionStation(){
        return this.screenService.productionStation();
    }

    @GetMapping("month-diagram")
    @Operation(description = "近期产品cp,cpk分布情况",summary = "近期产品cp,cpk分布情况")
    public List<LargeDataModel> monthDiagram(){
        return this.screenService.partCpCpk();
    }

    @GetMapping("day-diagram")
    @Operation(description = "cp,cpk增长情况",summary = "cp,cpk增长情况")
    public List<LargeDataModel> dayDiagram(){
       return this.screenService.curveCpCpk();
    }

}
